package pe.com.market.emarket.action;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import pe.com.market.common.util.Utilitario;
import pe.com.market.emarket.model.Product;

public class ListProductsAction {

	private List<Product> products;
	
	public String execute(){
		EntityManager em=Utilitario.getInstance().getEntityManager();
		String jpql="SELECT o FROM Product o";
		Query query=em.createQuery(jpql);
		products=query.getResultList();
		return "success";
	}

	public List<Product> getProducts() {
		return products;
	}

	public void setProducts(List<Product> products) {
		this.products = products;
	}
	
	
}